from frontend.roleApplication import RoleApplication
from frontend.form import Type

class OrderAcceptApplication(RoleApplication):
        def __init__(self):
            super(OrderAcceptApplication, self).__init__("CantonCandy", "Cashier")
            self.register_source_step("OrderAccept", self.take_candy_order_form_creator)
        '''
        Declare this application to be part of a given work flow and specify its role in that workflow.
        '''
        # Declare this application to be part of a given workflow, and responsible for a given role:
        # !!! Modify the following to use the actual work flow name and role name you need...
         
        # Declare any tasks that this role is able to perform:
        # !!! Modify to use actual name for this task...
         
        def take_candy_order_form_creator(self, stepname, form):
            form.add_static_label('What kind of candy would like to have: ')
            form.add_field(Type.SHORTSTRING, "CandyType")
            form.add_field(Type.SHORTSTRING, "CandyQuantity")
            #form.add_field(Type.SHORTSTRING, "CustomerName")
            form.add_field(Type.CHOICE, "PaymentType", labeltext="PaymentType", choices=['Cash', 'Credit'], initial='Cash');
        '''
        This method does the actual work of building the user interface.
        '''
        # !!! improve this text...
        
        
                # !!! Add at least two fields here, along with any additional static labels you need...

if __name__ == '__main__':
    #starts up the OrderTakerApplication:
    app = OrderAcceptApplication()
    #Start interacting with the user:
    app.MainLoop()

